import os, sys

def main():
    jpeg_file = "F:/dev2022/esp32-camera/test/pictures/conv.jpeg"
    if os.path.exists(jpeg_file):
        os.remove(jpeg_file)
    with open("F:/dev2022/esp32-camera/test/pictures/jpeg_data.bin", "r") as frp, open(jpeg_file, "ab") as fwp:
        data = frp.read()
        buf = data.split()
        for i in range(len(buf)):
            c = bytearray.fromhex(buf[i])
            fwp.write(c)


if __name__ == '__main__':
    main()